package com.oscar.springaidemo.ai.tools;

import org.springframework.ai.tool.ToolCallback;
import org.springframework.ai.tool.definition.DefaultToolDefinition;
import org.springframework.ai.tool.definition.ToolDefinition;
import org.springframework.ai.tool.function.FunctionToolCallback;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Description;
import org.springframework.stereotype.Component;

@Component
public class MyToolsCallBack {

    @Bean
    public ToolCallback functionToolCallback() {
//        return new FunctionToolCallback();
        return new ToolCallback() {
            @Override
            public ToolDefinition getToolDefinition() {
                ToolDefinition build = DefaultToolDefinition.builder()
                        .name("functionToolCallback")
                        .description("functionToolCallback")
                        .inputSchema("default")
                        .build();

                return build;
            }

            @Override
            public String call(String toolInput) {
                return "回调成功：" + toolInput;
            }
        };
    }

}
